#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time    : 2025/7/28
# @Author  : YunZhen
# @File    : text_filters.py
# @Software: PyCharm
"""
模板标签
"""

from django import template

register = template.Library()

@register.filter
def truncatechars(value, max_length):
    if len(value) <= max_length:
        return value
    return value[:max_length] + '...'
